/*
 *  pcThreads.c
 *  ProducerConsumer
 *
 *
 * Operating Systems Concepts Essentials
 *	Outline of Producer and Consumer Threads	p.268
 *
 *  Created by digi on 10/24/12.
 *  Copyright 2012 __MyCompanyName__. All rights reserved.
 *
 *	EECE 315
 *	Project #2
 *	
 *	Procucer-Consumer Problem
 *	
 *	Authors:
 *			Mohamed Ali
 *			Donald Cheng
 *			Krzysztof Mazurek
 *			Ishan Sahay
 *	
 *	Date: 24 / Oct / 2012
 *	
 */


/***********************
 Outline of Producer and Consumer Threads
 ***********************/


#include <stdlib.h> /* required for rand() */
#include "buffer.h"

void *producer(void *param) { 
	buffer_item item;
	while (TRUE) { 
		/* sleep for a random period of time */ 
		sleep(...); 
		/* generate a random number */ 
		item = rand(); 
		if (insert item(item))
			fprintf("report error condition"); 
		else
			printf("producer produced %d\n",item); 
	}
//}	
	
void *consumer(void *param) {
	buffer_item item;
	
	while (TRUE) { 
		/* sleep for a random period of time */ 
		sleep(...); 
		if (remove item(&item))
			fprintf("report error condition"); 
		else
			printf("consumer consumed %d\n",item);
	}
//}